//app.js
const Api = require('/net/api');
const http = require('/net/http');
const userManager = require('/js/userManager');
const wxApi = require('/js/wxApi');
const topicApi = require('/net/topicApi');
const util = require('/utils/util');
const store = require('/js/store');
const logger = require('/utils/logger');

App({
  onLaunch: function ( options ) {
    userManager.clearUserInfo();
    // 检查网络类型
    wxApi.checkNetType();
    // 获取邀请人手机号
    setTimeout(() => {
      getApp().globalData.inviterPhone = options.query.userPhone || null;
    });
  },
  globalData: {
    // 用户信息私有
    __userInfo: null,
    // 接口API
    Api,
    topicApi,
    // 网络请求
    http,
    // 封装微信API
    wxApi,
    // 常用工具类
    util,
    version: 'v1.2.0',
    store,
    logger: logger,
    userManager: userManager,
    setUserInfo: userManager.setUserInfo.bind(userManager),
    getUserInfo: userManager.getUserInfo.bind(userManager),
  }
})




